package com.ruoyi.web.controller.lynhgl;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.lynhgl.domain.TbLynhglSssjcx;
import com.ruoyi.lynhgl.service.ITbLynhglSssjcxService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 实时数据查询Controller
 * 
 * @author hc
 * @date 2023-11-10
 */
@RestController
@RequestMapping("/lynhgl/sssjcx")
public class TbLynhglSssjcxController extends BaseController
{
    @Autowired
    private ITbLynhglSssjcxService tbLynhglSssjcxService;

    /**
     * 查询实时数据查询列表
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbLynhglSssjcx tbLynhglSssjcx)
    {
        startPage();
        List<TbLynhglSssjcx> list = tbLynhglSssjcxService.selectTbLynhglSssjcxList(tbLynhglSssjcx);

        return getDataTable(list);
    }

    /**
     * 导出实时数据查询列表
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:export')")
    @Log(title = "实时数据查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbLynhglSssjcx tbLynhglSssjcx)
    {
        List<TbLynhglSssjcx> list = tbLynhglSssjcxService.selectTbLynhglSssjcxList(tbLynhglSssjcx);
        ExcelUtil<TbLynhglSssjcx> util = new ExcelUtil<TbLynhglSssjcx>(TbLynhglSssjcx.class);
        util.exportExcel(response, list, "实时数据查询数据");
    }

    /**
     * 获取实时数据查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbLynhglSssjcxService.selectTbLynhglSssjcxById(id));
    }

    /**
     * 新增实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:add')")
    @Log(title = "实时数据查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbLynhglSssjcx tbLynhglSssjcx)
    {
        return toAjax(tbLynhglSssjcxService.insertTbLynhglSssjcx(tbLynhglSssjcx));
    }

    /**
     * 修改实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:edit')")
    @Log(title = "实时数据查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbLynhglSssjcx tbLynhglSssjcx)
    {
        return toAjax(tbLynhglSssjcxService.updateTbLynhglSssjcx(tbLynhglSssjcx));
    }

    /**
     * 删除实时数据查询
     */
    @PreAuthorize("@ss.hasPermi('lynhgl:sssjcx:remove')")
    @Log(title = "实时数据查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbLynhglSssjcxService.deleteTbLynhglSssjcxByIds(ids));
    }
}
